import React from 'react';
import BaseComponent from '../Base/BaseComponent';

import {Switch} from 'antd';

export default class CtrlSwitch extends BaseComponent {
    constructor(props) {
        super(props);

        this.state = {
            value: props.value || false,
        }
    }

    componentWillReceiveProps(nextProps) {
        this.setState({value: nextProps.value})
    }

    render = () => (
        <Switch checked={this.state.value} onChange={this.props.onChange}/>
    )
}
